package com.ithjh.dao;

import com.ithjh.domain.Account;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AccountDao {

    @Insert("insert into tb_user (name,money) values (#{name},#{money})")
    void save(Account account);

    @Delete("delete from tb_user where id = #{id}")
    void delete(Integer id);

    @Update("update tb_user set name = #{name},money = #{money} where id = #{id}")
    void update(Account account);

    @Select("select * from tb_user")
    List<Account> findAll();

    @Select("select * from  account where id = #{id}")
    Account findById(Integer id);

}
